<template>
    <div>
        <h3>孙组件</h3>
        {{ name }}
        <button @click="changename">改名字</button>
    </div>
</template>

<script setup>
// 导入inject函数
import { inject } from 'vue'
let name = inject('uname')
let changename = inject('change-name')
</script>

<style lang="scss" scoped></style>